import { defHttp,jsonHttp } from '@/utils/http/axios';
import {
  chatidParams,
  deptListParams,
  deptUserListParams,
  integralListParams,
  rankingListParams,
} from './model/deptModel';
import { BasicListResult, BasicDataResult } from '../model/baseModel';

import { ErrorMessageMode } from '#/axios';

enum Api {
  //Login = '/login',
  goodList = '/hl/sys/good/goodList',
  saveGood = '/hl/sys/good/saveGood',
  goodDetail = '/hl/sys/good/goodDetail',
  importGood= '/hl/sys/good/importGood',
  goodDelete = '/hl/sys/good/goodDelete',
  goodUp = '/hl/sys/good/goodUp',
  goodDown = '/hl/sys/good/goodDown',
  categoryList = '/hl/sys/good/categoryList',
  saveCategory = '/hl/sys/good/saveCategory',
  categoryDetail = '/hl/sys/good/categoryDetail',
  categoryDelete = '/hl/sys/good/categoryDelete',
  categoryAll = '/hl/sys/good/categoryAll',
  orderList = '/hl/sys/good/orderList',
  orderItemList = '/hl/sys/good/orderItemList',
  operatorOrder = '/hl/sys/good/operatorOrder',
  orderCancel = '/hl/sys/good/orderCancel',
  takesOrder = '/hl/sys/good/takesOrder',
  totalOrderIntegral = '/hl/sys/good/totalOrderIntegral',
}

/**
 * @description: user login api
 */
export function goodListApi(params: deptListParams, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.goodList,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}

export function saveGoodApi(params: deptUserListParams, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.saveGood,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}

export function goodDetailApi(params: deptUserListParams, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.goodDetail,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}

export function importGood(params: deptUserListParams, mode: ErrorMessageMode = 'modal') {
  return jsonHttp.post<BasicDataResult>(
    {
      url: Api.importGood,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}



export function goodDeleteApi(params: chatidParams, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.goodDelete,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}

export function goodUpApi(params: integralListParams, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.goodUp,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}

export function goodDownApi(params: integralListParams, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.goodDown,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}

export function categoryListApi(params: integralListParams, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.categoryList,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}

export function saveCategoryApi(params: integralListParams, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.saveCategory,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}

export function categoryDetailApi(params: integralListParams, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.categoryDetail,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}
export function categoryDeleteApi(params: any, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.categoryDelete,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}
export function categoryAllApi(params: any, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.categoryAll,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}

export function orderListApi(params: any, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.orderList,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}

export function orderItemListApi(params: any, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.orderItemList,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}

export function orderCancelApi(params: any, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.orderCancel,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}
export function takesOrderApi(params: any, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.takesOrder,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}

export function totalOrderIntegralApi(params: any, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.totalOrderIntegral,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}
